// SelectLessonView.cpp : implementation of the CSelectLessonView class
//

#include "stdafx.h"
#include "SelectLesson.h"

#include "SelectLessonDoc.h"
#include "SelectLessonView.h"
#include "EditInformationSheet.h"
#include "ViewInformationSheet.h"
#include "SelectLessonDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSelectLessonView

IMPLEMENT_DYNCREATE(CSelectLessonView, CFormView)

BEGIN_MESSAGE_MAP(CSelectLessonView, CFormView)
	//{{AFX_MSG_MAP(CSelectLessonView)
	ON_BN_CLICKED(IDC_EDIT, OnEdit)
	ON_BN_CLICKED(IDC_VIEW, OnView)
	ON_BN_CLICKED(IDC_SELECT_LESSON, OnSelectLesson)
	//}}AFX_MSG_MAP
//	ON_MESSAGE(WM_USERAPPLY, OnUserApply)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSelectLessonView construction/destruction
//
//CSelectLessonView::CSelectLessonView():	m_shEdit(""),m_shView("")
	//CSelectLessonView::CSelectLessonView():\
//					CFormView(CSelectLessonView::IDD)\
//						m_shEdit(""),m_shView("")
			
CSelectLessonView::CSelectLessonView():\
			CFormView(CSelectLessonView::IDD),\
				m_shEdit(" "),m_shView(" ")
{
	//{{AFX_DATA_INIT(CSelectLessonView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here
/*    m_sh.m_page1.m_nFont = 0;
    m_sh.m_page2.m_bBold = FALSE;
    m_sh.m_page2.m_bItalic = FALSE;
    m_sh.m_page2.m_bUnderline = FALSE;
    m_sh.m_page3.m_nColor = 0;
    m_sh.m_page4.m_nFontSize = 12;*/
}
//

CSelectLessonView::~CSelectLessonView()
{
}

void CSelectLessonView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSelectLessonView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BOOL CSelectLessonView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void CSelectLessonView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CSelectLessonView diagnostics

#ifdef _DEBUG
void CSelectLessonView::AssertValid() const
{
	CFormView::AssertValid();
}

void CSelectLessonView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CSelectLessonDoc* CSelectLessonView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSelectLessonDoc)));
	return (CSelectLessonDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CSelectLessonView message handlers

void CSelectLessonView::OnEdit() 
{
	// TODO: Add your control notification handler code here
	m_shEdit.SetTitle("Edit Information");
//    m_bDefault = FALSE;
    m_shEdit.DoModal();

}
/*LRESULT CEx13aView::OnUserApply(WPARAM wParam, LPARAM lParam)
{
    TRACE("CEx13aView::OnUserApply -- wParam = %x\n", wParam);
    CHARFORMAT cf;
    Format(cf);
    if (m_bDefault) {
        m_rich.SetDefaultCharFormat(cf);
    }
    else {
        m_rich.SetSelectionCharFormat(cf);
    }
    return 0;
}*/
/*
void CEx13aView::Format(CHARFORMAT &cf)
{
    cf.cbSize = sizeof(CHARFORMAT);
    cf.dwMask = CFM_BOLD | CFM_COLOR | CFM_FACE |
                CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
    cf.dwEffects = (m_sh.m_page2.m_bBold ? CFE_BOLD : 0) |
                   (m_sh.m_page2.m_bItalic ? CFE_ITALIC : 0) |
                   (m_sh.m_page2.m_bUnderline ? CFE_UNDERLINE : 0);
    cf.yHeight = m_sh.m_page4.m_nFontSize * 20;
    switch(m_sh.m_page3.m_nColor) {
    case -1:
    case 0:
        cf.crTextColor = RGB(0, 0, 0);
        break;
    case 1:
        cf.crTextColor = RGB(255, 0, 0);
        break;
    case 2:
        cf.crTextColor = RGB(0, 255, 0);
        break;
    }
    switch(m_sh.m_page1.m_nFont) {
    case -1:
    case 0:
        strcpy(cf.szFaceName, "Times New Roman");
        break;
    case 1:
        strcpy(cf.szFaceName, "Arial");
        break;
    case 2:
        strcpy(cf.szFaceName, "Courier New");
        break;
    }
    cf.bCharSet = 0;
    cf.bPitchAndFamily = 0;
}*/

void CSelectLessonView::OnView() 
{
	// TODO: Add your control notification handler code here
	m_shView.SetTitle("View Information");
//    m_bDefault = FALSE;
    m_shView.DoModal();

}

void CSelectLessonView::OnSelectLesson() 
{
	// TODO: Add your control notification handler code here
	CSelectLessonDialog m_SelectLessonDialog;
	m_SelectLessonDialog.DoModal();
}
